<style>
    .form .label { width:110px; padding-right:15px; }
</style>
<div class="form" style="overflow: auto">
    <?php
    $form = $this->beginWidget('CActiveForm', array(
	'id' => 'photo-form',
	'enableAjaxValidation' => false,
	'enableClientValidation' => true,
	'clientOptions' => array('validateOnSubmit' => true, 'validateOnType' => true),
	'htmlOptions' => array('enctype' => 'multipart/form-data'),
    ));
    $photoState = Yii::app()->user->getState(app()->controller->id . GalleryController::PHOTO_CLASS_NAME);
    ?>

    <table class="form" style="width: 100%">
        <tr>
            <td class="label required"><?php echo $form->labelEx($model, 'name'); ?></td>
            <td class="input" >
		<?php echo $form->textField($model, 'name', array('style' => 'width:210px', 'placeholder' => t('PLH_PHOTO_NAME', 'gallery'))); ?>
		<?php echo $form->error($model, 'name'); ?>
            </td>
        </tr>
        <tr>
            <td class="label required" style="vertical-align: top;">
		<?php 
	    if ($model->scenario == Photo::SCENARIO_CREATE) {
		echo $form->labelEx($model, 'picture', array('class' => 'required')). ' *';
		} else {
		    echo $form->labelEx($model, 'picture', array(''));
		}
	    ?></td>
            <td class="input">
		<?php echo $form->fileField($model, 'picture', array('style' => 'width:224px',)); ?>
		<?php echo $form->error($model, 'picture'); ?>

		<?php echo '<br />' . substr($model->picture, strpos($model->picture, '_') + 1); ?>
		<div style="font-size: 13px;">
		    <b>Note</b> </br>		    
		    1. Allow format type : {"jpg","jpeg","bmp","png","gif"}	 </br>											
		    2. The file size must be less than or equal 1 MB											

		</div>
            </td>
        </tr>
        <tr>
            <td class="label required"><?php echo $form->labelEx($model, 'album_id'); ?></td>
            <td class="input">
		<?php
		echo $form->dropDownList($model, 'album_id', Html::listData(Album::model()->findAll(), 'id', 'name'), array(
		    'empty' => Yii::t('messages', 'MSG_FIRST_ITEM_ALBUM'), 'style' => 'width:200px',
		    'options' => $photoState['album_id'] != null ? array($photoState['album_id'] => array('selected' => true)) : array())
		);
		?>
		<?php echo $form->error($model, 'album_id'); ?>
            </td>
        </tr>
        <tr>
            <td class="label required"><?php echo $form->labelEx($model, 'status'); ?></td>
            <td class="input">
		<?php
		echo $form->dropDownList($model, 'status', Html::listData(LGHelpers::getStatusAlbum(), 'id', 'name'));
		?>
		<?php echo $form->error($model, 'status'); ?>
            </td>
        </tr>
        <tr>
            <td class="label required"><?php echo $form->labelEx($model, 'language'); ?></td>
            <td class="input">
		<?php
		echo $form->dropDownList($model, 'language', Html::listData(Language::model()->findAll(), 'code', 'value'), array(
		    'empty' => array('*' => 'All language')
			)
		);
		?>
		<?php echo $form->error($model, 'language'); ?>
            </td>
        </tr>
        <tr>
            <td class="label"><?php echo $form->labelEx($model, 'description'); ?></td>
            <td class="input"><?php echo $form->textArea($model, 'description', array('style' => 'width:215px;height:80px', 'placeholder' => t('PLH_DESCRIPTION', 'gallery'))); ?>
	    <?php echo $form->error($model, 'description'); ?></td> 
        </tr>


        <tr>
            <td colspan="2" class="cbutton">
		<?php echo Html::buttonConfirm(t('BTN_SAVE'), 'btnSave', 'ok', array('type' => 'submit', 'class' => 'button save update-file-dialog-submit-button')) ?>
		<?php echo Html::buttonConfirm(t('BTN_CANCEL'), 'photoCanceled', 'cancel'); ?>
            </td>
        </tr>
    </table>    
    <?php $this->endWidget(); ?>
    <script type="text/javascript">
	LGCMS.addTooltip();
    </script>

</div><!-- form -->
